#load long-form module list as data frame
data <- read.csv("../Data/ClusterProfiler/modules-gene-long.csv", header = TRUE)

#filter to  module
data.green <- data %>%
  filter(module == "green")

data.black <- data %>%
  filter(module == "black")

data.brown <- data %>%
  filter(module == "brown")

data.yellow <- data %>%
  filter(module == "yellow")

data.blue <- data %>%
  filter(module == "blue")

data.red <- data %>%
  filter(module == "red")

data.pink <- data %>%
  filter(module == "pink")

data.magenta <- data %>%
  filter(module == "magenta")

data.turquoise <- data %>%
  filter(module == "turquoise")

#Extract only list of KOs
data.green <- data.green$KO
data.black <- data.black$KO
data.brown <- data.brown$KO
data.yellow <- data.yellow$KO
data.blue <- data.blue$KO
data.pink <- data.pink$KO
data.magenta <- data.magenta$KO
data.turquoise <- data.turquoise$KO
data.red <- data.red$KO
#KEGG pathway over-representation analysis
k.green <- enrichKEGG(gene = data.green,
                      organism = 'ko',
                      pvalueCutoff = 0.05)
## Reading KEGG annotation online:
## 
## Reading KEGG annotation online:
k.black <- enrichKEGG(gene = data.black,
                      organism = 'ko',
                      pvalueCutoff = 0.05)

k.brown <- enrichKEGG(gene = data.brown,
                      organism = 'ko',
                      pvalueCutoff = 0.05)

k.yellow <- enrichKEGG(gene = data.yellow,
                      organism = 'ko',
                      pvalueCutoff = 0.05)

k.blue <- enrichKEGG(gene = data.blue,
                       organism = 'ko',
                       pvalueCutoff = 0.05)

k.red <- enrichKEGG(gene = data.red,
                     organism = 'ko',
                     pvalueCutoff = 0.05)

k.pink <- enrichKEGG(gene = data.pink,
                    organism = 'ko',
                    pvalueCutoff = 0.05)

k.magenta <- enrichKEGG(gene = data.magenta,
                    organism = 'ko',
                    pvalueCutoff = 0.05)

k.turquoise <- enrichKEGG(gene = data.turquoise,
                    organism = 'ko',
                    pvalueCutoff = 0.05)

#KEGG module over-representation analysis
m.green <- enrichMKEGG(gene = data.green,
                        organism = 'ko',
                        pvalueCutoff = 1,
                        qvalueCutoff = 1)
## Reading KEGG annotation online:
## 
## Reading KEGG annotation online:
m.black <- enrichMKEGG(gene = data.black,
                       organism = 'ko',
                       pvalueCutoff = 1,
                       qvalueCutoff = 1)

m.brown <- enrichMKEGG(gene = data.brown,
                       organism = 'ko',
                       pvalueCutoff = 1,
                       qvalueCutoff = 1)

m.yellow <- enrichMKEGG(gene = data.yellow,
                       organism = 'ko',
                       pvalueCutoff = 1,
                       qvalueCutoff = 1)

m.blue <- enrichMKEGG(gene = data.blue,
                        organism = 'ko',
                        pvalueCutoff = 1,
                        qvalueCutoff = 1)

m.red <- enrichMKEGG(gene = data.red,
                      organism = 'ko',
                      pvalueCutoff = 1,
                      qvalueCutoff = 1)

m.pink <- enrichMKEGG(gene = data.pink,
                      organism = 'ko',
                      pvalueCutoff = 1,
                      qvalueCutoff = 1)

m.turquoise <- enrichMKEGG(gene = data.turquoise,
                      organism = 'ko',
                      pvalueCutoff = 1,
                      qvalueCutoff = 1)

m.magenta <- enrichMKEGG(gene = data.magenta,
                      organism = 'ko',
                      pvalueCutoff = 1,
                      qvalueCutoff = 1)
## wrong orderBy parameter; set to default `orderBy = "x"`
## wrong orderBy parameter; set to default `orderBy = "x"`
## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.
## wrong orderBy parameter; set to default `orderBy = "x"`
## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.
## wrong orderBy parameter; set to default `orderBy = "x"`
## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.
## wrong orderBy parameter; set to default `orderBy = "x"`
## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.
## wrong orderBy parameter; set to default `orderBy = "x"`
## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.
## wrong orderBy parameter; set to default `orderBy = "x"`
## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.
## wrong orderBy parameter; set to default `orderBy = "x"`
## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.
## wrong orderBy parameter; set to default `orderBy = "x"`
## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.

Over-represented pathways

Dot plots

Network plots

## Warning: ggrepel: 19 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
## Warning: ggrepel: 127 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps

## wrong orderBy parameter; set to default `orderBy = "x"`
## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.
## wrong orderBy parameter; set to default `orderBy = "x"`
## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.
## wrong orderBy parameter; set to default `orderBy = "x"`
## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.
## wrong orderBy parameter; set to default `orderBy = "x"`
## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.
## wrong orderBy parameter; set to default `orderBy = "x"`
## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.
## wrong orderBy parameter; set to default `orderBy = "x"`
## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.
## wrong orderBy parameter; set to default `orderBy = "x"`
## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.
## wrong orderBy parameter; set to default `orderBy = "x"`
## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.
## wrong orderBy parameter; set to default `orderBy = "x"`
## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.

Over-represented modules

Dot plots

### Network plots

## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.
## `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.
## `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.
## `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.
## `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.
## `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.